home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c,comp.lang.c++
- Path: news.sprintlink.net!news1!ind-004-236-178
- From: dlmiller@iquest.net (Doug Miller)
- Subject: Re: Statistically Random Number algorithm
- X-Nntp-Posting-Host: ind-004-236-178.iquest.net
- Message-ID: <DoJADr.I48@iquest.net>
- Sender: news@iquest.net (News Admin)
- Organization: IQuest Network Services
- X-Newsreader: News Xpress Version 1.0 Beta #2.1
- References: <314D0B67.3C16@psu.edu> <4in2ao$5ee@newserv.agcs.com>
- Date: Tue, 19 Mar 1996 21:32:04 GMT
-
- "George B. T. Greene" <greeneg@agcs.com> wrote:
- +Xref: news1 comp.lang.c:71054 comp.lang.c++:88917
- +Path: news1!news.sprintlink.net!newserv.agcs.com!news
- +From: "George B. T. Greene" <greeneg@agcs.com>
- +Newsgroups: comp.lang.c,comp.lang.c++
- +Subject: Re: Statistically Random Number algorithm
- +Date: 19 Mar 1996 19:35:52 GMT
- +Organization: AG Communication Systems, ITS
- +Lines: 26
- +Message-ID: <4in2ao$5ee@newserv.agcs.com>
- +References: <314D0B67.3C16@psu.edu>
- +NNTP-Posting-Host: greeneg.agcs.com
- +Mime-Version: 1.0
- +Content-Type: text/plain; charset=us-ascii
- +Content-Transfer-Encoding: 7bit
- +X-Mailer: Mozilla 1.2N (Windows; I; 32bit)
- +
- +Whew!
- +
- +"Jason A. Soloff" <jas251@psu.edu> wrote:
- +>
- +>I am working on a monte carlo simulation program to model some problems
- +>in astronomy. One thing I am running into, however, is the problem of
- +>the pseudo-random number tables. Does anyone have an algorithm (or
- +>code) for a truly statistically random number generator?
- +
- +This is not exactly a trivial question. I'd suggest for a start getting a
- +copy of Donald Knuth's "The Art of Computer Programming" volume 2:
- +"Seminumerical Algorithms," and reading chapter 3. You'll learn a lot
- +about what it takes to make a (pseudo)-random number sequence "good" in
- +some sense, and how to test the result of any effort in that direction.
- +Check out his "algorithm M" in particular. However, please note that the
- +chapter starts with a quote from John von Neumann: "Anyone who considers
- +arithmetical methods of producing random number digits is, of course, in a
- +state of sin."
- +
- +You should also give some thought as to how you are going to use the
- +numbers. For example, if you use them in pairs, or n-tuples generally,
- +you'd want to check the distribution of the tuples. (I can imagine your
- +project as generating simulated star fields, in which case you might be
- +generating position coordinate pairs for individual stars.)
- +
- +
- I believe that Robert Sedgwick's book "Algorithms in C" has some examples.
-